﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;


namespace 人事工资管理系统
{
    public partial class frmChangePrize : Form
    {
        public frmChangePrize()
        {
            InitializeComponent();
        }
        PMSClass.DBOperate operate = new PMSClass.DBOperate();
        SqlConnection conn = PMSClass.DBConnection.MyConnection();
        private void frmChangePrize_Load(object sender, EventArgs e)
        {
            this.Text = "[" + txtname + "]的奖惩信息";
            string sql = "select * from tb_prize";
            DataSet ds = operate.GetTable(sql);
            ds.Dispose();
            cbbUserNum.SelectedItem = ds.Tables[0].Rows[0][1].ToString();
            cbbUserJFType.SelectedItem = ds.Tables[0].Rows[0][4].ToString();
            txtname.Text = ds.Tables[0].Rows[0][2].ToString();
            txtdep.Text = ds.Tables[0].Rows[0][3].ToString();
            txtJFcontent.Text = ds.Tables[0].Rows[0][5].ToString();
            txtJL.Text = ds.Tables[0].Rows[0][6].ToString();
            txtFK.Text = ds.Tables[0].Rows[0][7].ToString();
            txtJFdate.Text = ds.Tables[0].Rows[0][8].ToString();
            txtCXDate.Text=ds.Tables[0].Rows[0][9].ToString();

        }

        private void cbbUserJFType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbbUserJFType.Text == "奖励")
            {
                txtFK.Enabled = false;
                txtFK.Text = "0";
                txtJL.Text = "true";
            }
            else
            {
                txtJL.Enabled = false;
                txtJL.Text = "0";
                txtFK.Enabled = true;
            }
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            string id = cbbUserNum.Text.ToString();
            string strUpdateSql="update tb_User set UserID='"+cbbUserNum.Text+"',UserName='"+txtname.Text+"',UserDep='"+txtdep.Text+"',UserJF='"+cbbUserJFType.Text+"',UserJFcontent'"+txtJFcontent.Text+"',UserJLMoney'"+txtJL.Text+"',UserFKMoney'"+txtFK.Text+"',UserJFData'"+txtJFdate.Text+"',UserCXData'"+txtCXDate.Text+"'where UserID='"+id+"'";
            operate.OperateData(strUpdateSql);
        }
    }
}
